//
//  CPBaseMJExtenModel.m
//  CPBaseXCode
//
//  Created by cp on 2024/9/19.
//

#import "CPBaseMJExtenModel.h"
#import "MJExtension.h"

@implementation CPBaseMJExtenModel
- (id)mj_newValueFromOldValue:(id)oldValue property:(MJProperty *)property
{
    if (oldValue == nil || [oldValue isEqual:[NSNull null]] || oldValue == NULL || [oldValue isEqual:@"(null)"] || [oldValue isEqual:@"<null>"] || [oldValue isEqual:@""])
    {
        if ([property.type.typeClass  isEqual:[NSMutableDictionary class]]){
            
            return @{};
        }else if ([property.type.typeClass  isEqual:[NSDictionary class]]){
            
            return @{};
        }else if ([property.type.typeClass  isEqual:[NSArray class]]){
            
            return @[];
        }else if ([property.type.typeClass isEqual:[NSMutableArray class]]){
            
            return @[];
        }else if ([property.type.typeClass isEqual:[NSString class]]){
            
            return @"";
            
        }else if ([property.type.typeClass isEqual:[NSNumber class]]){
            
            return @(0);
        }
        
    }
    return oldValue;
    
}
@end
